import request from '@/config/axios'

// 心理测评题目 VO
export interface PsychQuestionVO {
  id: number // 主键
  title: string // 题目
  optionList: string // 选项信息
  riskLevel: string // 风险等级（字典表：business_psych_question_risk_level）
  questionType: boolean // 题型（0单选 1多选）
  sort: number // 排序（从小到大）
}

// 心理测评题目 API
export const PsychQuestionApi = {
  // 查询心理测评题目分页
  getPsychQuestionPage: async (params: any) => {
    return await request.get({ url: `/business/psych-question/page`, params })
  },

  // 查询心理测评题目详情
  getPsychQuestion: async (id: number) => {
    return await request.get({ url: `/business/psych-question/get?id=` + id })
  },

  // 新增心理测评题目
  createPsychQuestion: async (data: PsychQuestionVO) => {
    return await request.post({ url: `/business/psych-question/create`, data })
  },

  // 修改心理测评题目
  updatePsychQuestion: async (data: PsychQuestionVO) => {
    return await request.put({ url: `/business/psych-question/update`, data })
  },

  // 删除心理测评题目
  deletePsychQuestion: async (id: number) => {
    return await request.delete({ url: `/business/psych-question/delete?id=` + id })
  },

  // 删除心理测评题目
  deletePsychQuestionList: async (ids: number[]) => {
    return await request.delete({ url: `/business/psych-question/delete-list`, params: { ids: ids.join(',') } })
  },

  // 导出心理测评题目 Excel
  exportPsychQuestion: async (params) => {
    return await request.download({ url: `/business/psych-question/export-excel`, params })
  },
}
